<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr=[11,22,33,44,55];



        // 重写forEach
        // Array.prototype.MyforEach=function(callback){
        //     for(var i=0;i<this.length;i++){
        //         callback(this[i],i,this)
        //     }
        // }

        // arr.MyforEach(function(item,index,list){
        //     console.log(item,index,list);
        // })



        // 重写map
        Array.prototype.Mymap=function(callback){
            var lis=[];
            for(var i=0;i<this.length;i++){
                lis.push(callback(this[i],i,this))
            }
            return lis;
        }

        var res=arr.Mymap(function(item,index,list){
            return item*10;
        })
        console.log(res);
    </script>
</body>
</html>